package edu.ynu.se.xiecheng.achitectureclass.demo.entity.data;

import edu.ynu.se.xiecheng.achitectureclass.demo.entity.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;

import javax.persistence.*;

@Getter
@Setter
@Entity
@Table(name = "sensor_data")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "sensor_type", discriminatorType = DiscriminatorType.STRING)
@Where(clause = "is_deleted = 0")
@ApiModel(description = "传感器数据信息")
public class SensorData extends Data {
    @Column(name = "value")
    @ApiModelProperty(value = "传感器数值", required = true)
    private Double value;

    @Column(name = "sensor_type", insertable = false, updatable = false)
    @ApiModelProperty(value = "传感器类型", required = true)
    private String sensorType;
}